//
//  DWHomeSmallCell.m
//  DWduitang
//
//  Created by Lina Zhang on 16/9/29.
//  Copyright © 2016年 hl. All rights reserved.
//
#import "DWHomeItem.h"
#import "DWHomeSmallCell.h"
#import <UIImageView+WebCache.h>
@interface DWHomeSmallCell ()
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UILabel *styleLabel;
@property (weak, nonatomic) IBOutlet UILabel *authorLabel;
@property (weak, nonatomic) IBOutlet UILabel *countLabel;
@property (weak, nonatomic) IBOutlet UIImageView *iconImageView;

@end
@implementation DWHomeSmallCell
/*
 @property (nonatomic , strong ) NSString *content_category;
 @property (nonatomic , strong ) NSString *titleText;
 @property (nonatomic , strong ) NSString *image_url;
 @property (nonatomic , strong ) NSString *nickname;
 @property (nonatomic , strong ) NSString *style;
 @property (nonatomic , strong ) NSString *tag;
 @property (nonatomic , strong ) NSString *target;
 @property (nonatomic , strong ) NSString *enabled_at_str;
 @property (nonatomic , strong ) NSString *dynamic_info2;
 */
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setFrame:(CGRect)frame
{
    frame.size.height -= 7;
    [super setFrame:frame];
}

-(void)setItem:(DWHomeItem *)item{
    _item = item;
    self.titleLabel.text = item.titleText;
    self.styleLabel.text = item.content_category;
    if (item.nickname) {
        self.authorLabel.hidden = NO;
        if ([item.nickname isEqualToString:@""]) {
            self.authorLabel.hidden = YES;
        }else{
            self.authorLabel.hidden = NO;
            self.authorLabel.text = [NSString stringWithFormat:@"|  %@",item.nickname];
        }
    }else{
        self.authorLabel.hidden = YES;
    }
    self.countLabel.text = item.dynamic_info2;
    [self.iconImageView sd_setImageWithURL:[NSURL URLWithString:item.image_url] placeholderImage:[UIImage imageNamed:@"gift_overdue"]];
}

@end
